<!DOCTYPE html>
<!-- saved from url=(0030)./sign_up.html -->
<html>

<head>
  <!--谷歌分析工具-->
  <!--https://www.imhunk.com/install-google-webmasters-and-google-analytics/#title1-->
  <meta name="google-site-verification" content="_glN7pkglI6X0zN5WcqtUqWcdsZYrHjodY0N-RU1O08" />
  <!-- Google tag (gtag.js) -->
  <script async src="https://www.googletagmanager.com/gtag/js?id=G-VEDJEGSS57"></script>
  <script>
    window.dataLayer = window.dataLayer || [];
    function gtag(){dataLayer.push(arguments);}
    gtag('js', new Date());
    gtag('config', 'G-VEDJEGSS57');
  </script>
  <link rel="shortcut icon" href="images/title-icon.png">
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <style type="text/css">
    .turbo-progress-bar {
      position: fixed;
      display: block;
      top: 0;
      left: 0;
      height: 3px;
      background: #0076ff;
      z-index: 2147483647;
      transition:
        width 300ms ease-out,
        opacity 150ms 150ms ease-in;
      transform: translate3d(0, 0, 0);
    }
  </style>
  <script type="text/javascript" async="" src="./js/js"></script>
  <script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.min.js"></script>
  <!-- 引入 Axios -->
  <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
  <script src="./common/request.js"></script>
  <script src="./js/347575881032536" async=""></script>
  <script type="text/javascript" async="" src="./js/mixpanel-2-latest.min.js.下载"></script>
  <link rel="shortcut icon" href="images/title-icon.png">
<title>Dreamy.ai - Chat and connect with AI Companions</title>
<link rel="canonical" href="http://dreamyai.vip/sign_up.html">
  <meta property="og:type" content="website">
  <meta name="viewport" content="width=device-width,initial-scale=1, maximum-scale=1">

  <link rel="stylesheet" href="./js/application-0f3c2308946d2d1b69e62b0c26417ad898bc6b6a6b7857e90524059e7bb67d30.css"
    data-turbo-track="reload">

  <script src="./js/jquery-3.6.0.min.js.下载"></script>
  <script src="./js/checkout.js.下载"></script>
  <script src="https://cdn.bootcss.com/blueimp-md5/2.12.0/js/md5.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.min.js"></script>
  <!-- 引入 Axios -->
  <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
  <script src="./common/request.js"></script>
</head>
<!-- <script src="https://apis.google.com/js/platform.js" async defer></script> -->
<script>
  window.fbAsyncInit = function () {
    FB.init({
      appId: '1316206252400141',
      cookie: true,
      xfbml: true,
      version: 'v12.0'
    });

    FB.AppEvents.logPageView();
  };

  (function (d, s, id) {
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) { return; }
    js = d.createElement(s); js.id = id;
    js.src = "https://connect.facebook.net/en_US/sdk.js";
    fjs.parentNode.insertBefore(js, fjs);
  }(document, 'script', 'facebook-jssdk'));
</script>
<script>
  function handleCredentialResponse(response) {
    var credential = response.credential;
    console.log(response)
    axios.post('https://api.dreamyai.vip/oauth/callback', { oauth_token: response.credential },).then(result => {
      if (result.data.code == 200) {
        localStorage.setItem('token', result.data.data);
        axios.get("https://api.dreamyai.vip/member/memberDetail", {
          headers: {
            "Authorization": localStorage.getItem('token')
          }
        })
          .then((res) => {
            if (res.data.code == '200' && res.data.data) {
              // console.log("用户信息", res.data);
              if (res.data.data.expirationTime) {
                new Date(Number(res.data.data.expirationTime)) - new Date() > 0 ? res.data.data.expirationState = 1 : res.data.data.expirationState = 0
              } else {
                res.data.data.expirationState = 0
              }
              localStorage.setItem('userInfo', JSON.stringify(res.data.data))
              // console.log(res.data.data, 'res.data.datares.data.data')
              window.location.href = './explore.html'
            }

          })
          .catch((err) => {
            console.log(err);
          });
      }
    })
    // 使用credential进行后续操作，例如发送到服务器验证
  }
  function onSignIn(googleUser) {
    // 处理登录成功的逻辑
    var profile = googleUser.getBasicProfile();
    console.log('ID: ' + profile.getId());
    console.log('Name: ' + profile.getName());
    console.log('Image URL: ' + profile.getImageUrl());
    console.log('Email: ' + profile.getEmail());
  }
  const url = window.location.href;
  const paramsString = url.split('?')[1];
  const params = new URLSearchParams(paramsString);
  const state = params.get('state');
  console.log(state, url)
  if (state) {
    axios.post('https://api.dreamyai.vip/oauth/login', { state: params.get('state'), code: params.get('code'),type: 'GOOGLE' },).then(result => {
      if (result.data.code == 200) {
        localStorage.setItem('token', result.data.data);
        axios.get("https://api.dreamyai.vip/member/memberDetail", {
          headers: {
            "Authorization": localStorage.getItem('token')
          }
        })
          .then((res) => {
            if (res.data.code == '200' && res.data.data) {
              // console.log("用户信息", res.data);
              if (res.data.data.expirationTime) {
                new Date(Number(res.data.data.expirationTime)) - new Date() > 0 ? res.data.data.expirationState = 1 : res.data.data.expirationState = 0
              } else {
                res.data.data.expirationState = 0
              }
              localStorage.setItem('userInfo', JSON.stringify(res.data.data))
              // console.log(res.data.data, 'res.data.datares.data.data')
              window.location.href = './explore.html'
            }

          })
          .catch((err) => {
            console.log(err);
          });
      }
      console.log(JSON.stringify(res.data))
    })
  }
</script>

<body class="bg-main registrations new">

  <div id="app">

    <div class="flex min-h-full flex-col justify-center py-12 sm:px-6 lg:px-8 bg-neutral-950">
      <div class="sm:mx-auto sm:w-full sm:max-w-md relative z-10">
        <h2 class="mt-6 text-center text-xl font-semibold leading-loose text-white">
          Welcome!
        </h2>
        <p class="text-center text-white">Sign up to your account</p>
      </div>
      <div class="p-6 sm:mx-auto sm:w-full sm:max-w-[480px] relative z-10">
        <div class="bg-stone-900 px-6 py-12 shadow rounded-lg sm:px-12 border border-neutral-700">
          <div id="g_id_onload" @click="gogleLik"
            data-client_id="380012165420-8pp4r1tt6tkpkll8pa1o19slg5i0s23o.apps.googleusercontent.com"
            data-callback="handleCredentialResponse">
            <div name="button" type="submit"
              class="inline-flex items-center justify-center w-full bg-white text-sm font-normal border border-gray-300 rounded-md px-4 py-2.5">
              <img alt="Google" class="h-4 w-4 mr-3"
                src="./js/google-auth-a8a364c5c399770d07ce74e6110a120970b1953557a47719692d85ea9334efb6.png">
              <div class="g-signin2" data-onsuccess="onSignIn"
                data-clientid="380012165420-8pp4r1tt6tkpkll8pa1o19slg5i0s23o.apps.googleusercontent.com">Sign in with
                Google</div>

            </div>
          </div>
          <div id="g_id_onload" style="margin-top: 10px;" @click="faceLik"
            data-client_id="380012165420-8pp4r1tt6tkpkll8pa1o19slg5i0s23o.apps.googleusercontent.com"
            data-callback="handleCredentialResponse">
            <div name="button" type="submit"
              class="inline-flex items-center justify-center w-full bg-white text-sm font-normal border border-gray-300 rounded-md px-4 py-2.5">
              <img alt="Google" class="h-4 w-4 mr-3"
                src="./images/facebook.png">
              <div class="g-signin2" data-onsuccess="onSignIn"
                data-clientid="380012165420-8pp4r1tt6tkpkll8pa1o19slg5i0s23o.apps.googleusercontent.com">Sign in with
                Facebook</div>

            </div>
          <!-- <div class="flex items-center justify-between mt-5">
            <hr class="border-white w-1/3">
            <span class="text-white text-sm font-medium px-3">OR</span>
            <hr class="border-white w-1/3">
          </div> -->
    
          <div class="simple_form mt-5" id="new_user">
            <div class="form-inputs mb-3">
              <div class="w-full flex-col justify-start items-start gap-1.5 inline-flex">
                <div class="self-stretch flex-col justify-start items-start gap-1.5 flex relative">
                  <div class="w-5 h-5 absolute top-[13px] left-[10px]">
                    <img src="./images/icon_email.svg" alt="">
                  </div>
                  <div class="input email required user_email w-full"><input
                      class="string email required w-full self-stretch pl-10 px-3.5 py-2.5 rounded-lg shadow border border-[#363636] justify-start items-center gap-2 inline-flex text-white bg-stone-900"
                      required="required" aria-required="true" placeholder="Email" type="email" v-model='upText'
                      name="user[email]" id="user_email" data-gtm-form-interact-field-id="0"></div>
                </div>
              </div>
              <div class="w-full flex-col justify-start items-start gap-1.5 inline-flex mt-5">
                <div class="self-stretch flex-col justify-start items-start gap-1.5 flex relative">
                  <div class="w-5 h-5 absolute top-[13px] left-[10px]">
                    <img src="./images/icon_seeting.svg">
                  </div>
                  <div class="w-5 h-5 absolute top-[13px] right-[10px]">
                    <img src="./images/icon_eye.svg"
                      @click='inputType === "password"? inputType ="text": inputType = "password"'
                      class="password-toggle-icon cursor-pointer">
                  </div>
                  <div class="input password required user_password w-full"><input v-model='upPwd' maxlength="18"
                      minlength="6"
                      class="password required w-full self-stretch pl-10 px-3.5 py-2.5 rounded-lg shadow border border-[#363636] justify-start items-center gap-2 inline-flex text-white bg-stone-900"
                      required="required" aria-required="true" placeholder="Password" :type="inputType"
                      name="user[password]" id="user_password" data-gtm-form-interact-field-id="1"></div>
                </div>
              </div>
            </div>
            <div
              class="w-full mt-4 px-4 py-3 bg-[#E75275] rounded-[10px] border border-[#E75275] justify-center items-center gap-2 inline-flex text-white"
              id="signup-btn" @click='upCli' style='cursor: pointer;'>
              Sign up
            </div>
            <div class="italic text-sm text-gray-500 mt-2">By signing up, you agree to <a class="underline"
                target="_blank"
                href="https://find-heart.cn-sh2.ufileos.com/sugar/service/Terms%20of%20Service.pdf">Terms of
                Service</a></div>
          </div>
          <div class="mt-5" style="width: 100%; height: 0px; opacity: 0.20; border: 0.50px white solid"></div>
          <div class="flex mt-5 font-light text-sm justify-center items-center gap-2 inline-flex text-white">
            Already have an account yet?
            <a href='./sign_in.html' class="text-[#E75275] text-sm font-semibold leading-normal"> Sign in</a>
          </div>
        </div>
      </div>
    </div>

  </div>
  <div class="w-full h-[56px] fixed bottom-0 bg-neutral-950 background-gradient z-20 block lg:hidden">
    <div class="flex p-[15px] justify-between">
      <!-- Discover Icon -->
      <a href="./explore.html">
        <img src="./images/explore.png" style="width: 24px">
      </a>
      <!-- My AI Icon -->
      <a href="./myai.html" class="relative">
        <img src="./images/myai.png" style="width: 24px">
      </a>
      <!-- Create AI Icon -->
      <a href="./create1.html" class="relative">
        <img src="./images/create.png">
      </a>
      <!-- Chat Icon -->
      <a href="./chart.html">
        <img src="./images/chat.png" style="width: 24px">
      </a>


    </div>
  </div>

</body>

</html>
<script>
  window.onload = function () {
    var app = new Vue({
      el: '#app',
      data() {
        return {
          upText: '',
          upPwd: '',
          inputType: 'password'
        }
      },

      mounted() {


      },
      methods: {
        faceLik() {
          instance.get("/oauth/authorizingUrl", {
            params: { type: 'FACEBOOK'   }
            
          }).then(res => {
            if (res.data.code == 200) {
              location.href = res.data.data
            }
          })
        },
        gogleLik() {
          instance.get("/oauth/login", {
            params: { type: 'GOOGLE'   }
            
          }).then(res => {
            if (res.data.code == 200) {
              location.href = res.data.data
            }
          })
        },
        upCli() {
          if (!this.upText || !this.upPwd) {
            alert('请输入必填项')
            return
          }
          if (this.upPwd.length >= 6 && this.upPwd.length <= 18) {
            if (this.upText && this.upPwd) {
              instance.post("/member/register", {
                email: this.upText,
                passWord: md5(this.upPwd)
              })
                .then((result) => {

                  // instance.post("/member/sendActivation", {
                  //   email: this.upText,
                  // })
                  //   .then((result) => {

                  //   })
                  //   .catch((err) => {
                  //     console.log(err);
                  //   });

                  // // result.data才是真正的返回结果
                  console.log("真正的数据：", result.data);
                  if (result.data.code === "200") {
                    // window.location.href = './sign_in.html'
                    window.location.href = './verify.html?sendEmail=' + this.upText
                  }
                })
                .catch((err) => {
                  console.log(err);
                });
            }
          } else {
            alert('Incorrect password format')
          }

        }
      }
    })
  }
</script>